<template>
    <div>
      <!--面包屑-->
      <div>
        <el-breadcrumb separator-class="el-icon-arrow-right" :stripe="true">
          <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
          <el-breadcrumb-item>权限管理</el-breadcrumb-item>
          <el-breadcrumb-item>权限列表</el-breadcrumb-item>
        </el-breadcrumb>
      </div>
      <!--权限线性列表-->
      <div class="content">
        <template>
          <el-table :data="tableData"  border style="width: 100%" class="bor">
            <el-table-column type="index" label="#"></el-table-column>
            <el-table-column prop="authName" label="订单列表" ></el-table-column>
            <el-table-column prop="path" label="路径" ></el-table-column>
            <el-table-column prop="level" label="权限等级" >
              <template slot-scope="scope">
                <el-tag v-if="scope.row.level=='0'">等级一</el-tag>
                <el-tag  v-else-if="scope.row.level=='1'" type="success">等级二</el-tag>
                <el-tag v-else type="warning">等级三</el-tag>
              </template>
            </el-table-column>
          </el-table>
        </template>
      </div>
    </div>
</template>

<script>
    export default {
        name: "rights",
       created:function(){
          this.init();
       },
       data:function(){
          return{
            tableData:[], //权限数据
          }
       },
       methods:{
          init:async function(){
             let {data:res} = await this.$http.get('rights/list');
             if(res.meta.status!='200'){
               return this.$message.error('获取权限用户数据失败');
             }
             this.tableData =res.data;
          }
       },

    }
</script>

<style scoped lang="less">
  .content{
    margin-top: 15px;
    padding: 25px 15px;
    background-color: #ffffff;
  }

</style>
